from browser . logic import browser_logic

class mediator_fake :
    def __init__ ( self ) :
        self . _browser_return = False
    def add_title_label_to_browser ( self , title_text ) :
        pass
    def add_table_to_browser ( self ) :
        pass
    def add_return_button_to_browser ( self ) :
        pass
    def add_action_button_to_browser ( self , action_text ) :
        pass
    def add_title_row_to_browser ( self , number , name , creation_time , modification_time , size ) :
        pass
    def add_existing_row_to_browser ( self , number , name , creation_time , modification_time , size ) :
        pass
    def add_empty_row_to_browser ( self ) :
        pass
    def add_action_row_to_browser ( self ) :
        pass
    def focus_entry_in_browser ( self ) :
        pass
    def select_table_row ( self , row ) :
        pass
    def localization_browser_number ( self ) :
        pass
    def localization_browser_existing_name ( self ) :
        pass
    def localization_browser_creation_time ( self ) :
        pass
    def localization_browser_modification_time ( self ) :
        pass
    def localization_browser_size ( self ) :
        pass
    def fetch_all_knowledge_bases ( self ) :
        pass
    def on_browser_return ( self ) :
        self . _browser_return = True
    
class browser_logic_on_key_escape_tests :
    'browser_logic_on_key_escape'
    def __init__ ( self , test ) :
        self . _test = test
        self . _mediator = mediator_fake ( )
        self . _browser_logic = browser_logic ( self . _mediator )
    def test_on_key_escape_browser_return ( self ) :
        self . _browser_logic . show_browser ( )
        self . _browser_logic . on_key_escape ( )
        self . _test . assume_true ( self . _mediator . _browser_return )
    def test_on_key_escape_do_nothing_before_show ( self ) :
        self . _browser_logic . on_key_escape ( )
        self . _test . assume_false ( self . _mediator . _browser_return )
    def test_on_key_escape_do_nothing_after_hide ( self ) :
        self . _browser_logic . show_browser ( )
        self . _browser_logic . hide_browser ( )
        self . _browser_logic . on_key_escape ( )
        self . _test . assume_false ( self . _mediator . _browser_return )
